<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /*
    创建对象的三种方法：
    1.字面量创建{描述对象}
    2.构造函数创建对象：第一步定义构造函数，第二步实例化对象
    3.new object()
    */
    console.log(Math.PI);
    console.log(Math.max(1,45,78,1236,0,99,-1111));
    console.log(Math.ceil(Math.random()*50));
    function getRandomArbitrary(min,max){
        return Math.random() * (max - min) + min;

    }
    console.log(Math.random());
    console.log(getRandomArbitrary(3,9));
    console.log('----------------');
    function getRandomIntInclusive(min, max) {
        const minCeiled = Math.ceil(min);
        const maxFloored = Math.floor(max);
        return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); 
    }
    console.log(getRandomIntInclusive(1,100));
    console.log('----------------');
    function cai(min,max){
        return Math.floor(Math.random()*(min-max+1)+min);
    }
    let boom = cai(1,10);
    let num;
    while(true){
        num = prompt('你猜错了！');
        if(num === boom){
            alert('nichaileile!哈哈哈');
            break;
        }else if(num > boom){
            alert('你猜小了');

        }else{
            alert('你猜大了');
        }
    }
</script>
</html>